/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.goods.entity;

import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.jeesite.common.entity.BaseEntity;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.entity.TreeEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 公司管理Entity
 * @author ThinkGem
 * @version 2017-03-23
 */
@Table(name="zt_goods_type", alias="a", columns={
		@Column(includeEntity=BaseEntity.class),
		@Column(includeEntity=DataEntity.class),
		@Column(includeEntity=TreeEntity.class),
		
		@Column(name="goods_code", 	attrName="goodsCode", 	label="类型编码", isPK=true),
		@Column(name="view_code", attrName="viewCode", label="类型代码"),
		@Column(name="state", attrName="state", label="状态"),
		@Column(name="imgname", attrName="imgname", label="状态"),
		@Column(name="type", attrName="type", label="分类栏目类型",queryType=QueryType.LIKE),
		@Column(name="img", attrName="img", label="图片"),
		@Column(name="name", 	attrName="name", 	label="类型名称", queryType=QueryType.LIKE, isTreeName=true),
		@Column(name="putaway",attrName = "putaway",label="上架数量"),
		@Column(name="for_sale",attrName = "forSale",label="上架数量"),
		@Column(name="sold_out",attrName = "soldOut",label="上架数量"),
		@Column(name="automatic_down",attrName = "automaticDown",label="上架数量"),
		
	},  extWhereKeys="dsf", orderBy="a.tree_sorts desc, a.goods_code"
)
public class GoodsType extends TreeEntity<GoodsType> {
	private Integer state;           //类型0下架    1上架
	private static final long serialVersionUID = 1L;
	private String goodsCode;		// 类型编码
	private String viewCode;		// 类型代码
	private String name;		// 类型名称
	private String imgname;
	private String oldType;
	
	private String typeName;
	
	private String type;
	private String img;
	private Integer putaway,  forSale,  soldOut,  automaticDown;
	
	public String getImgname() {
		return imgname;
	}

	public void setImgname(String imgname) {
		this.imgname = imgname;
	}

	public String getOldType() {
		return oldType;
	}

	public void setOldType(String oldType) {
		this.oldType = oldType;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getImg() {
		return img;
	}

	public void setImg(String img) {
		this.img = img;
	}

	public GoodsType() {
		this(null);
	}

	public GoodsType(String id){
		super(id);
	}
	
	@Override
	public GoodsType getParent() {
		return parent;
	}

	@Override
	public void setParent(GoodsType parent) {
		this.parent = parent;
	}
	
	public String getGoodsCode() {
		return goodsCode;
	}

	public void setGoodsCode(String goodsCode) {
		this.goodsCode = goodsCode;
	}
	
	@NotBlank(message="商品类型代码不能为空")
	@Pattern(regexp="[a-zA-Z0-9_]{0,30}", message="代码长度不能大于 30 个字符，并且只能包含字母、数字、下划线")
	public String getViewCode() {
		return viewCode;
	}

	public void setViewCode(String viewCode) {
		this.viewCode = viewCode;
	}
	
	@NotBlank(message="商品类型名称不能为空")
	@Length(min=0, max=200, message="商品类型名称长度不能超过 200 个字符")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	public Integer getPutaway() {
		return putaway;
	}

	public void setPutaway(Integer putaway) {
		this.putaway = putaway;
	}

	public Integer getForSale() {
		return forSale;
	}

	public void setForSale(Integer forSale) {
		this.forSale = forSale;
	}

	public Integer getSoldOut() {
		return soldOut;
	}

	public void setSoldOut(Integer soldOut) {
		this.soldOut = soldOut;
	}

	public Integer getAutomaticDown() {
		return automaticDown;
	}

	public void setAutomaticDown(Integer automaticDown) {
		this.automaticDown = automaticDown;
	}
	
	
	
	
}